package com.lz.zk.model;

import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ClassModel{
	/**
	 * 名称
	 */
	private String name;
	/**
	 * 包名
	 */
	private String packageName;
	/**
	 * 作者
	 */
	private String author;
	/**
	 * 版本
	 */
	private String version;
	/**
	 * 备注
	 */
	private String remark;
	/**
	 * 方法
	 */
	private List<MethodModel> method;
	/**
	 * 附加实体类
	 */
	private List<ParamModel> param;
	
	/**
	 * 关联实体类
	 */
	private List<ClassModel> model;
	
	private String text;
	
	public ClassModel() {
		
	}
	

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getPackageName() {
		return packageName;
	}

	public void setPackageName(String packageName) {
		this.packageName = packageName;
	}


	public List<ParamModel> getParam() {
		return param;
	}


	public void setParam(List<ParamModel> param) {
		this.param = param;
	}


	public List<ClassModel> getModel() {
		return model;
	}

	public void setModel(List<ClassModel> model) {
		this.model = model;
	}



	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public String getAuthor() {
		return author;
	}



	public void setAuthor(String author) {
		this.author = author;
	}



	public String getVersion() {
		return version;
	}



	public void setVersion(String version) {
		this.version = version;
	}



	public String getRemark() {
		return remark;
	}



	public void setRemark(String remark) {
		this.remark = remark;
	}



	public List<MethodModel> getMethod() {
		return method;
	}



	public void setMethod(List<MethodModel> method) {
		this.method = method;
	}
	
//	public Model(String str){
//		str = str.replaceAll("\n\t", " ");
//		str = str.replaceAll("\n", " ");
//		str = str.replaceAll("\r", " ");
//		String head = str.substring(str.lastIndexOf("import "), str.indexOf("class"));
//		//Model mod = new Model();
//		//Pattern pt1 = Pattern.compile(".*?<(.*?)>.*?");
//		Pattern pt1 = Pattern.compile(".*?<(.*?)>.*?");
//		Matcher match1 = pt1.matcher(head.substring(0, head.indexOf("@")));
//		if (match1.find()) {
//			this.setRemark(match1.group(1));
//		}else {
//			Pattern ppt1 = Pattern.compile(".*?//(.*?)@.*?");
//			Matcher pmatch1 = ppt1.matcher(head);
//			if (pmatch1.find()) {
//				this.setRemark(pmatch1.group(1));
//			}else {
//				Pattern pppt1 = Pattern.compile(".*?\\/\\*(.*?)@.*?");
//				Matcher ppmatch1 = pppt1.matcher(head);
//				if (ppmatch1.find()) {
//					this.setRemark(ppmatch1.group(1));
//				}
//			}
//		}
//		this.setRemark(this.getRemark()==null?null:this.getRemark().replaceAll("\\*", "").replaceAll(" ", ""));
//		Pattern pt2 = Pattern.compile(".*?@author(.*?)[@|\\*/].*?");
//		Matcher match2 = pt2.matcher(head);
//		if (match2.find()) {
//			this.setAuthor(match2.group(1));
//		}
//		Pattern pt3 = Pattern.compile(".*?@version(.*?)[@|\\*/].*?");
//		Matcher match3 = pt3.matcher(head);
//		if (match3.find()) {
//			this.setVersion(match3.group(1));
//		}
//		Pattern p1 = Pattern.compile("package(.*?);");
//		Matcher m1 = p1.matcher(str);
//		if (m1.find()) {
//			this.setPackageName(m1.group(1).replaceAll(" ", ""));
//		}
//		str = str.substring(str.indexOf("class") + 5);
//		Pattern p2 = Pattern.compile("(.*?)(implements|extends|\\{).*?");
//		Matcher m2 = p2.matcher(str);
//		if (m2.find()) {
//			this.setName(m2.group(1).replaceAll(" ", ""));
//		}
//	}
//	
//	public Model buildMethodInfo(){
//		return this;
//	}
//	
//	public Model buildParamInfo(){
//		return this;
//	}
//	
//	public Model buildRelateEntityInfo(){
//		return this;
//	}

}
